<?php
namespace Shopiuu\Model;

use Shopiuu\Http\RequestCore;

class Settings extends Model{
    
    public function __construct($accessToken, $endpoint)
    {
        parent::__construct($accessToken, $endpoint);
    }

    /**
     * Modify article
     * @param array $paramss array(
        [config_web_title] => title
        [config_web_keywords] => keywords
        [config_web_description] => description
        [config_web_copyright] => Copyright © 2020 SHOP INC. All Rights Reserved.
        [config_robotstxt] => User-agent: *
    Allow: /
    User-agent: baiduspiter_bot
    Disallow: /
        [config_base_language] => 2
        [config_base_currency] => 1
        [config_store_timezone] => GMT+8
        [config_search_analyzer] => icu_analyzer
        [config_emailconfig_adminemail] => test@qq.com
        [config_emailconfig_sendemail] => 
        [config_emailconfig_password] => 
        [config_emailconfig_nickname] => 
        [config_emailconfig_smtp] => 
        [config_emailconfig_port] => 
        [config_emailconfig_replyemail] => test@qq.com
        [config_visit_limit_username] => admin
        [config_visit_limit_password] => 123456
        [config_visit_limit_redirect_type] => 1
        [config_visit_limit_descript] => 
        [config_visit_limit_redirect_url] => http://www.baidu.com
        [config_rewrite_type] => 0
        [config_order_number_prefix] => D
        [config_pixel_google_ads_id] => AW-123456789
        [config_pixel_google_trade_id] => AW-123456789/BtvVCJTBlcsDEIXnx9ID
        [config_pixel_facebook] => 
        [config_pixel_youtube] => 
        [config_pixel_pintrest] => 
        [config_pixel_instgram] => 
        [config_shop_domain_password] => 123456789
        )
     * @return ResponseCore
     */
    public function update($params)
    {
        $request = $this->getRequest('/openApi/settings/update');
        $result = $request->set_body(json_encode($params))->set_method('POST')->send_request(true);
        return $result;
    }

    /**
     * Get getSettings
     * @return ResponseCore
     */
    public function getSettings()
    {
        $request = $this->getRequest('/openApi/settings/getSettings');
        $result = $request->set_body(json_encode($params))->set_method('GET')->send_request(true);
        return $result;
    }
    
}